import*as e from"../../../core/platform/platform.js";import*as t from"../../lit-html/lit-html.js";import*as i from"../helpers/helpers.js";import*as r from"../render_coordinator/render_coordinator.js";import*as n from"../../../models/bindings/bindings.js";const o=new CSSStyleSheet;o.replaceSync(".link:link,\n.link:visited{color:var(--color-link);text-decoration:underline;cursor:pointer;outline-offset:2px}\n/*# sourceURL=linkifierImpl.css */\n");const s=r.RenderCoordinator.RenderCoordinator.instance();class l extends Event{data;static eventName="linkifieractivated";constructor(e){super(l.eventName,{bubbles:!0,composed:!0}),this.data=e,this.data=e}}class a extends HTMLElement{static litTagName=t.literal`devtools-linkifier`;#e=this.attachShadow({mode:"open"});#t=e.DevToolsPath.EmptyUrlString;#i;#r;set data(e){if(this.#t=e.url,this.#i=e.lineNumber,this.#r=e.columnNumber,!this.#t)throw new Error("Cannot construct a Linkifier without providing a valid string URL.");this.#n()}connectedCallback(){this.#e.adoptedStyleSheets=[o]}#o(e){e.preventDefault();const t=new l({url:this.#t,lineNumber:this.#i,columnNumber:this.#r});this.dispatchEvent(t)}async#n(){await s.write((()=>{t.render(t.html`<a class="link" href="${this.#t}" @click="${this.#o}"><slot>${function(e,t){if(e){let i=`${n.ResourceUtils.displayNameForURL(e)}`;return void 0!==t&&(i+=`:${t+1}`),i}throw new Error("New linkifier component error: don't know how to generate link text for given arguments")}(this.#t,this.#i)}</slot></a>`,this.#e,{host:this})}))}}i.CustomElements.defineComponent("devtools-linkifier",a);var c=Object.freeze({__proto__:null,LinkifierClick:l,Linkifier:a});export{c as Linkifier};
